/* Copyright (C) 2008 Robin Debreuil -- Released under the BSD License */

using System;
using System.Collections.Generic;
using System.CodeDom.Compiler;


namespace SWF
{
	public struct ClipActions
	{
		public ClipEvents ClipEvents;
		public List<ClipActionRecord> ClipActionRecords;

		public ClipActions(SwfReader r) : this(r, true)
		{
		}
		public ClipActions(SwfReader r, bool isSwf6Plus)
		{
			r.GetUI16(); // reserved
			ClipEvents = (ClipEvents)r.GetBits(32);
			ClipActionRecords = new List<ClipActionRecord>();

			bool hasMoreRecords = true;
			while (hasMoreRecords)
			{
				ClipActionRecord car = new ClipActionRecord(r, isSwf6Plus);
				ClipActionRecords.Add(car);
				if ((uint)car.ClipEvents == 0)
				{
					hasMoreRecords = false;
				}
			}
		}
	}
}
